const Koa = require('koa');
const Router = require('koa-router');


const app = new Koa()
const router = new Router()

// app.use( async (ctx, next) => {
//   console.log('-------ctx----')
//   console.log(ctx.method)
//   console.log(ctx.path)
//   if(ctx.path == '/class/laster') {
//     ctx.body = {
//       key: 'halang'
//     }
//   }
// })
router.get('/class/laster', (ctx, next) => {
  ctx.response.body = {key: 'halang'}
})

router.get('/class/laster2', (ctx, next) => {
  ctx.response.body = {key: 'halang2'}
})

router.get('/class/laster3', (ctx, next) => {
  ctx.response.body = {key: 'halang3'}
})

app.use(router.routes());

app.listen(4002, () => { console.log('listen port 4002')})


